bin=httpserver	#目标文件
cc=g++	#编译器
LD_FLAGS=-std=c++11 -lpthread -g #-DDEBUG=1 #编译选项
# curr=$(shell pwd)
src=main.cc	#源文件

# .PHONY:ALL
# ALL:$(bin) CGI

# $(bin):$(src)
# 	$(cc) -o $@ $^ $(LD_FLAGS)

# CGI:
# 	cd $(curr)/cgi;\
# 	make all;\ 
# 	cd -;

$(bin):$(src)
	$(cc) -o $@ $^ $(LD_FLAGS)

# .PHONY:clean
# clean:
# 	rm -f $(bin)
# 	rm -rf output
# 	cd $(curr)/cgi;\ 
# 	make clean;\
# 	cd -;

.PHONY:clean
clean:
	rm $(bin)
	rm -r output

.PHONY:output
output:
	mkdir -p output 
	cp $(bin) output
	cp -rf wwwroot output
	cp ./cgi/test_cgi output/wwwroot
	cp ./cgi/shell_cgi.sh output/wwwroot
	cp ./cgi/mysql_conn output/wwwroot
